Convis Linear Filters


In [1]:
%pylab inline
import convis


Populating the interactive namespace from numpy and matplotlib
/home/jacob_unencrypted/Environments/py3/lib/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters

One Dimensional Filtering

The Conv1d filter affects only the temporal dimension of the input by convolving it with a temporal weight.


In [2]:
model = convis.filters.Conv1d()
model.exponential(0.01)
model.plot_impulse()


Out[2]:
Output containing a 1x1x500x10x10 Tensor.

Two Dimensional Filtering

The Conv2d filter affects only the spatial dimension of the input by convolving it with a spatial weight.


In [3]:
model = convis.filters.Conv2d()
model.gaussian(0.1)
model.plot_impulse((10,21,21))


Out[3]:
Output containing a 1x1x10x21x21 Tensor.

Thre Dimensional Filtering

The Conv3d filter is the most flexible filter and convolves the input with a spatio-temporal weight.


In [4]:
model = convis.filters.Conv3d()
model.set_weight(randn(10,5,5))
model.plot_impulse((100,21,21))


Out[4]:
Output containing a 1x1x100x21x21 Tensor.

RF: Receptive Field

The RF class has only a 1 pixel output, so different receptive fields have to be created by using additional out_channels that each has a 3d filter. Similar to the Conv3d filter, RF does a 3d convolution, but it removes padding and cuts the input to the exact size of the weight. The result is a spatio-temporal receptive field that will give a single time series as an output.


In [5]:
model = convis.filters.RF()
model.set_weight(randn(10,5,5))
model.plot_impulse((100,9,9))


Out[5]:
Output containing a 1x1x100x1x1 Tensor.

In [6]:
model = convis.filters.RF(bias=False)
model.set_weight(randn(3,1,10,20,20))
inp = convis.samples.random_checker_stimulus(10,20,20).repeat(20,0)
o = model.run(inp,dt=200)
o


Out[6]:
Output containing a 1x3x200x1x1 Tensor.